package cn.edu.scnu.show_and_find_movies.mapper;

import cn.edu.scnu.show_and_find_movies.model.Movie;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShowMapper {
    @Select("select id,title,type,region,rating,is_vip,week_hits,month_hits,total_hits,image from movies order by total_hits desc limit 10")
    List<Movie> getHotMovies();
    @Select("select id,title,type,region,rating,is_vip,week_hits,month_hits,total_hits,image from movies where type=#{type}")
    List<Movie> getMoviesByType(String type);
    @Select("select id,title,type,region,rating,is_vip,week_hits,month_hits,total_hits,image from movies where region=#{region}")
    List<Movie> getMoviesByRegion(String region);
    @Select("select id,title,type,region,rating,is_vip,week_hits,month_hits,total_hits,image from movies where id=#{movieId}")
    Movie getMovieById(Integer movieId);
}
